package com.oc.claimobs.bb;

import javax.microedition.location.Location;
import javax.microedition.location.LocationListener;
import javax.microedition.location.LocationProvider;

import net.rim.device.api.ui.Screen;

import com.oc.claimobs.bb.gps.LocationService;

public class ClaimsMob extends net.rim.device.api.ui.UiApplication { 
	
	public static void main(String[] args) {
		ClaimsMob instance = new ClaimsMob();
		instance.enterEventDispatcher();
	}

	public ClaimsMob() {
		initApplication();
	}

	private LocationService locationService = null;
	
	private void initApplication() {
		
		try {

		locationService = new LocationService(new LocationListener() {
			public void providerStateChanged(LocationProvider provider,
					int newState) {
				// Not implemented
			}	

			public void locationUpdated(LocationProvider provider,
					Location location) {
				if (location.isValid()) {
					ScreenFlow.getInstance().setCurrentLocation(location);
				}
			}

		});
		
		} catch(Exception ex){
			
		}

		//Screen screen = new InfoScreen();
		Screen screen = ScreenFlow.getInstance().getNext(null);
		pushScreen(screen);
	}

	public LocationService getLocationService() {
		return locationService;
	}

}
